<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<title>标题</title>
	<meta name="keywords" content="">
	<meta name="description" content="">
	<style type="text/css">
		*{
				padding: 0;
				margin: 0;
				border: 0;
		}
		body{
			/*width: 100%;
			height: 100%;*/
			background: url(2.jpg) no-repeat; 
			background-size: cover;
		}
	</style>
	<script src="https://cdn.bootcss.com/jquery/2.0.0/jquery.min.js"></script>
</head>
<body>
	<p style="font-size: 5rem;margin-top: 27rem;margin-left: 23rem;display: inline-block;"></p>
</body>
<script type="text/javascript">
	function random(min,max){
		return Math.round(Math.random()*(max-min)+min)
	}
	var num = random(1000,10000);
	$("p").html(num)

	(function(win){
				var ratio,scaleValue,renderTime,
						document=window.document,
						docElem=document.documentElement,
						vpm=document.querySelector('meta[name="viewport"]');
				if(vpm){
					var tempArray=vpm.getAttribute("content").match(/initial\-scale=(["']?)([\d\.]+)\1?/);
					if(tempArray){
						scaleValue=parseFloat(tempArray[2]);
						ratio=parseInt(1/scaleValue);
					}
				}else{
					vpm=document.createElement("meta");
					vpm.setAttribute("name","viewport");
					vpm.setAttribute("content","width=device-width,initial-scale=1,user-scalable=no,minimal-ui");
					docElem.firstElementChild.appendChild(vpm);
				}

				win.addEventListener("resize",function(){
					clearTimeout(renderTime);
					renderTime=setTimeout(initPage,300);
				},false);

				win.addEventListener("pageshow", function(e) {
					e.persisted && (clearTimeout(renderTime),renderTime=setTimeout(initPage,300));
				}, false);

				"complete"===document.readyState?document.body.style.fontSize =12*ratio+"px":
						document.addEventListener("DOMContentLoaded",function(){
							document.body.style.fontSize =12*ratio+"px";
						},false);
				initPage();
				function initPage(){
					var htmlWidth=docElem.getBoundingClientRect().width;
					if(htmlWidth>640) htmlWidth=640;
					htmlWidth/ratio>640 && (htmlWidth=640*ratio);
					win.rem=htmlWidth/16;
					docElem.style.fontSize=win.rem+"px";
				}
			})(window);
</script>
</html>